A standard way to communicate between two processes 1 and 2 (running on the same machine or running on different machines) is to send a message, via, e.g., an interprocess communication (IPC) mechanism. Often, for example, it is desirable to enable process 1 to send a message to process 2 asking process 2 to execute code on behalf of process 1. Typically, process 1 must have knowledge of a port or contact point for process 2 in order to do this.
The procedure of transforming the function call into a message is called marshalling. Marshalling converts what the code in process 1 sees as a function call into 1 message to be sent to process 2. The message must contain the name of the function and a set of parameters, coded in a way that process 2 understands. Process 2 receives the message and has to transform the message into a call to process 2's internal function. The process of converting a message into a function call is called unmarshalling. The piece of code that performs marshalling in process 1 is called a proxy and typically resides in the client process. The corresponding piece of code on the server side that performs unmarshalling is called a stub. A reverse set of marshalling/unmarshalling occurs for the return parameters when process 2 returns results to process 1.
When a large amount of data needs to be transferred between processes and/or when a small portion of a larger piece of data needs to be accessed by another process, marshalling the data is very inefficient. Using shared memory is one way of avoiding the marshalling overhead, however it requires synchronization and trust between the processes
A conventional way to accomplish the above when processes are cooperating processes is to set up a copy-on-write (COW). COW buffers are shared by multiple processes (or shared by a single process in multiple locations). When the buffer is modified, the writing process then receives its own copy of the object stored therein. However, while COW is efficient because copies are not made until a buffer is modified, the efficiencies can be further improved when the intent of the sending process is to pass ownership of the buffer to the receiver, or if the sender will not access the buffer anyway.
Thus, there is a need for system that improves over the limitations of the prior art. The present invention provides such a solution.